import { defHttp } from '@/utils/http/axios';
import { DeptListGetResultModel, DeptListItem } from '@/api/system/model/deptModel';

const basePath = '/system/sysDept/';
const buildUrl = (url: string) => basePath + url;
enum Api {
  DeptList = 'getDeptList',
  DeptAddOrEdit = 'addOrUpdate',
  DeptDeleteRecord = 'deleteRecord',
  DeptMap = 'deptMap',
}

export const getDeptList = (params?: DeptListItem) =>
  defHttp.get<DeptListGetResultModel>({ url: buildUrl(Api.DeptList), params });

export const queryDeptMap = (params?: DeptListItem) =>
  defHttp.get({ url: buildUrl(Api.DeptMap), params });

export const deptAddOrEdit = (params) =>
  defHttp.post({ url: buildUrl(Api.DeptAddOrEdit), params }, { errorMessageMode: 'none' });

export const deptDeleteRecord = (params) =>
  defHttp.post({ url: buildUrl(Api.DeptDeleteRecord), params }, { errorMessageMode: 'none' });
